feat(tracer): report OTLP export status in startup log#5062
Conversation
Add three boolean fields to the "DATADOG TRACER CONFIGURATION" startup log indicating whether each telemetry signal is exported over OTLP: - otlp_traces_export_enabled (tracer's cached otlpExportMode, which reflects that CI-Visibility and log-to-stdout writers are selected ahead of the OTLP writer) - otlp_metrics_export_enabled (OTel metrics signal enabled AND the OTLP metrics exporter selected: RuntimeMetricsOtelEnabled() && OTLPExportMetricsMode(); defaults to false, matching the other tracers) - otlp_logs_export_enabled (config LogsOTelEnabled) Update the startup-log golden assertions and clear the OTLP-driving env vars in the test so the expected output is deterministic regardless of shell/CI env pollution. Add a positive case asserting the metrics field is true when the OTel metrics signal and OTLP exporter are both active. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Config Audit |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: f3a578b | Docs | Datadog PR Page | Give us feedback! |
BenchmarksBenchmark execution time: 2026-07-24 23:34:47 Comparing candidate commit f3a578b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 326 metrics, 0 unstable metrics, 1 flaky benchmarks without significant changes.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab2d1374a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| OTLPMetricsExportEnabled: t.config.internalConfig.RuntimeMetricsOtelEnabled() && t.config.internalConfig.OTLPExportMetricsMode(), | ||
| OTLPLogsExportEnabled: t.config.internalConfig.LogsOTelEnabled(), |
There was a problem hiding this comment.
Derive OTLP export flags from actual startup state
When a tracer-only application sets DD_METRICS_OTEL_ENABLED=true or DD_LOGS_OTEL_ENABLED=true, these fields are logged as enabled even though no OTLP exporter may be running: OTel metrics only start when the optional ddtrace/opentelemetry/metric package has registered otelmetricsinstall.StartHook, and the tracer does not start the OTel log integration here. This makes the startup diagnostic claim metrics/logs are exported over OTLP based only on config flags, which can mislead users debugging why no OTLP data is leaving the process; the metric value should at least use the same condition as otelRuntimeMetricsShouldBeEnabled, and logs need an actual integration-started signal rather than just LogsOTelEnabled().
Useful? React with 👍 / 👎.
Derive otlp_metrics_export_enabled in the startup log from otelRuntimeMetricsShouldBeEnabled, the same gate the tracer uses to start OTel runtime metrics, instead of RuntimeMetricsOtelEnabled && OTLPExportMetricsMode. The old predicate over-reported: it logged true even when the opentelemetry/metric package was not imported (StartHook nil) or runtime metrics were off, so no OTLP pipeline was actually running. Logs keep reporting LogsOTelEnabled (config intent) because the user starts the OTel logs integration after the startup log is emitted, so no started-state is knowable at that point. Add a startup-log test for the config-intent-without-pipeline case and update the positive test to install a stub StartHook so the pipeline is genuinely active. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What does this PR do?
Adds three boolean fields to the "DATADOG TRACER CONFIGURATION" startup log (
startupInfoinddtrace/tracer/log.go) that report whether each telemetry signal is exported over OTLP:otlp_traces_export_enabled: the tracer's cachedotlpExportMode(true whenOTEL_TRACES_EXPORTER=otlpselects the OTLP trace writer, after CI Visibility and log-to-stdout writers have been ruled out)otlp_metrics_export_enabled:RuntimeMetricsOtelEnabled() && OTLPExportMetricsMode()otlp_logs_export_enabled:LogsOTelEnabled()It also updates the
log_test.gogolden assertions for the new fields and clears the OTLP-driving env vars inTestStartupLogso the expected output is deterministic regardless of shell/CI env pollution. A new subtest assertsotlp_metrics_export_enabledis true when both the OTel metrics signal and the OTLP metrics exporter are active.Motivation
Part of a cross-tracer effort to report OTLP export status in the startup diagnostic log using identical JSON keys across the dd-trace-* libraries. These flags make it easy to confirm which signals a service exports over OTLP when diagnosing configuration.
Reviewer's Checklist
make lintlocally. (gofmtclean on both files.)make testlocally. (TestStartupLogand all subtests pass.)make generatelocally. (N/A: no generated files touched.)🤖 Generated with Claude Code
Related PRs — cross-tracer OTLP startup-log effort